//
// 作者：AKA_GGbond
// 时间：2025/7/17
// 邮箱：evain_wl@163.com
//

#ifndef ESMU_W_RESPONSIVEFORM_H
#define ESMU_W_RESPONSIVEFORM_H

#include <QWidget>
#include "W_HelloButton.h"
class W_ScrollBar;
class Transparent_transition_interface;
class W_Login;
class W_RegistrationForm;
class QPropertyAnimation;

#define W_ResponsiveFormIns W_ResponsiveForm::Instance()

class W_ResponsiveForm : public QWidget
{
    Q_OBJECT
    Q_PROPERTY(int animation_duration READ animation_duration WRITE setAnimation_duration FINAL)

public:
    explicit W_ResponsiveForm(QWidget *parent = nullptr);
    ~W_ResponsiveForm();

    static W_ResponsiveForm *Instance();

public slots:
    void setRightShow();
    void execute_animation(W_HelloButton::AnimationState status);
    void onAnimation3Finished();
    void onAnimation4Finished();

protected:
    void paintEvent(QPaintEvent *event);
    void mousePressEvent(QMouseEvent* event);
    void mouseMoveEvent(QMouseEvent* event);
    void resizeEvent(QResizeEvent* event);

private:
    void build_animation();
    int animation_duration() const;
    void setAnimation_duration(int newAnimation_duration);
    void updateMask();
    void createRoundPath(QPainterPath& path);
    void crop_corner();

private:
    W_ScrollBar* scroll_bar{nullptr};
    Transparent_transition_interface *transparent_transition_interface{nullptr};
    Transparent_transition_interface* transparent_transition_interface2{nullptr};
    W_RegistrationForm* registration_form{nullptr};
    W_Login* login_form{nullptr};

    QPropertyAnimation* animation2{nullptr};
    QPropertyAnimation* animation3{nullptr};
    QPropertyAnimation* animation4{nullptr};
    QPropertyAnimation* animation5{nullptr};
    QPropertyAnimation* animation6{nullptr};

    QPoint m_dragStartPosition;
    QPoint m_startWindowPosition;
    int currentSequence = 1;
    bool animation_execute_duration = false;
    bool animation_restore_duration = false;
    int m_animation_duration = 600;
};


#endif //ESMU_W_RESPONSIVEFORM_H
